package com.wish233.wiliwiliapi.client;

import com.wish233.wiliwiliapi.domain.dto.UserDTO;
import com.wish233.wiliwiliapi.fallback.UserClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author WHH
 */
@FeignClient(name = "wiliwili-user",
        configuration = FeignInterceptor.class,// 请求拦截器 （关键代码）
        fallbackFactory = UserClientFallback.class // 降级处理器
)
public interface UserClient {

    @PostMapping("/user/dto/batch")
    Map<Long, UserDTO> getUserByIdBatch(@RequestBody Set<Long> userIds);

    @PostMapping("/user/dto/batch/list")
    List<UserDTO> getUserByIdBatchSorted(@RequestBody Set<Long> userIds);

    @GetMapping("/user/dto")
    UserDTO getUserDTOById(@RequestParam("id") Long id);

}
